/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {number[]}
 * 输入：root = [1,null,2,3]
输出：[1,3,2]
 */
var inorderTraversal = function (root) {
  const res = []
  if (!root) {
    return res
  }
  const start = root => {
    if (root.left) {
      start(root.left)
    }
    res.push(root.val)
    root.right && start(root.right)
  }
  start(root)
  return res
}
